using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class GetSessionPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["jsemail"] != null)
        {          
            
            //GetSessions();
            //GetSessionContents();  
            //GetSessionValue();
            AddSession();
            SessionCount();
            IsNewSession();
        }
        else
            Response.Redirect("CreateSessionPage.aspx");
    }
    void GetSession()
    {
        Literal1.Text = "Email: " + Session["jsemail"].ToString();
        Literal2.Text = "UserID: " + Session["jsid"].ToString();
        
        
    }
    void GetSessionContents()
    {
        Literal1.Text = "Get all session name by Contents property<br>";
        foreach (string session in Session.Contents)
        {
            Literal1.Text += session +"<br>";
        }
    }
    void GetSessionValue()
    {
        Literal1.Text = "Get all session name by Keys property<br>";
        foreach(string session in Session.Keys)
        {
            Literal1.Text += session + ": " + 
            Session[session].ToString()+ "<br> ";
        }
    }
    void SessionCount()
    {
        Literal2.Text = "Get all session name by Keys property<br>";
        for (int i=0;i< Session.Count;i++)
        {
            Literal2.Text += Session.Keys[i] + ": " +
            Session[i].ToString() + "<br> ";
        }
    }
    void IsNewSession()
    {
        if(Session.IsNewSession)
        {
            Literal1.Text ="This is new session";
        }
    }
    void AddSession()
    {
        Session.Add("jsCurrentResumeId","12");
    }
    void AbandonSession()
    {
        Session.Abandon();
    }
    void RemoveMethods()
    {
        
        Session.Remove("jsemail");
        Session.RemoveAt(1);
        Session.RemoveAll();
    }

    
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        RemoveMethods(); 
    }
}
